#include "customroledialog.h"

CustomRoleDialog::CustomRoleDialog(QWidget *parent)
    : QDialog(parent)
    , roleNameEdit(new QLineEdit(this))
    , promptEdit(new QTextEdit(this))
{
    setWindowTitle("创建自定义角色");

    // 布局
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    // 角色名称
    mainLayout->addWidget(new QLabel("角色名称:", this));
    mainLayout->addWidget(roleNameEdit);

    // 提示词
    mainLayout->addWidget(new QLabel("提示词:", this));
    mainLayout->addWidget(promptEdit);

    // 按钮
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    QPushButton *okButton = new QPushButton("确认", this);
    QPushButton *cancelButton = new QPushButton("取消", this);
    buttonLayout->addWidget(okButton);
    buttonLayout->addWidget(cancelButton);
    mainLayout->addLayout(buttonLayout);

    // 连接信号
    connect(okButton, &QPushButton::clicked, this, &QDialog::accept);
    connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);

    // 设置默认大小
    resize(400, 300);
}

QString CustomRoleDialog::getRoleName() const
{
    return roleNameEdit->text().trimmed();
}

QString CustomRoleDialog::getPrompt() const
{
    return promptEdit->toPlainText().trimmed();
}
